package sul.hot;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.view.View;
import android.widget.AdapterView.OnItemSelectedListener;

public class Hotels extends Activity implements OnItemSelectedListener,View.OnClickListener {
    /** Called when the activity is first created. */
	String hNames[] = {"Sulaymania Palace","High Creest","Karkuk Plaza","Azadi Hotel","Azmer Palace","Mazi Plaza"};
	Spinner spin;
	Button go;
	public int pos = 0;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.hotel);
        go = (Button)findViewById(R.id.g);
        spin = (Spinner)findViewById(R.id.spinner1);
        ArrayAdapter<String> spin_adapter = new ArrayAdapter<String>(Hotels.this,
        		android.R.layout.simple_spinner_item, hNames);

        spin.setAdapter(spin_adapter);
        spin.setOnItemSelectedListener(this);
        go.setOnClickListener(this);
    }
    @Override
    public void onItemSelected(AdapterView<?> arg0, View arg1,
            int position, long id) { 
        // TODO Auto-generated method stub
		pos = spin.getSelectedItemPosition();
    }

    @Override
    public void onNothingSelected(AdapterView<?> arg0) {
        // TODO Auto-generated method stub
    	
    }
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(go.getId() == ((Button)v).getId()){
			Intent myIntent = new Intent(v.getContext(),Profile.class);
			startActivityForResult(myIntent, 0);
			Intent i = new Intent(this, Profile.class);
		    i.putExtra("Value1",pos+"");
		    startActivityForResult(i, 10);
			}
	}
}
